#ifndef UTILS_H
#define UTILS_H

#include <string>
#include <chrono>  // For time operations
#include <iomanip> // For put_time
#include <sstream> // For string streams
#include <ctime>   // For time_t, tm

namespace MiniBanking
{

    /**
     * @brief Provides common utility functions for the banking system.
     *
     * Includes functions for getting formatted date/time strings and
     * sanitizing strings for use in filenames.
     */
    class Utils
    {
    public:
        // Delete constructor - this class is only meant for static methods
        Utils() = delete;

        /**
         * @brief Gets the current date as a string in YYYY-MM-DD format.
         * @return A string representing the current date.
         */
        static std::string getCurrentDateString();

        /**
         * @brief Gets the current date and time as a string in YYYY-MM-DD HH:MM:SS format.
         * @return A string representing the current date and time.
         */
        static std::string getCurrentDateTimeString();

        /**
         * @brief Sanitizes a string part for safe use in a filename.
         * Currently replaces spaces with underscores. More rules could be added.
         * @param input The string to sanitize.
         * @return The sanitized string.
         */
        static std::string sanitizeFilenamePart(const std::string &input);

        /**
         * @brief Formats a chrono time_point into a string (YYYY-MM-DD HH:MM:SS).
         * @param timePoint The time point to format.
         * @return Formatted date and time string.
         */
        static std::string formatTimestamp(const std::chrono::system_clock::time_point &timePoint);
    };

} // namespace MiniBanking

#endif // UTILS_H
